<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="/layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Resposta</f:facet>

		<s:decorate id="enunciado" template="/layout/display.xhtml">
            <ui:define name="label">Enunciado</ui:define>
            <h:outputText value="#{respostaHome.instance.questao.questao}"/>
        </s:decorate>
		
        <s:decorate id="resposta" template="/layout/display.xhtml">
            <ui:define name="label">Resposta</ui:define>
            <h:outputText value="#{respostaHome.instance.resposta}"/>
        </s:decorate>

        <s:decorate id="cliques" template="/layout/display.xhtml">
            <ui:define name="label">Cliques</ui:define>
            <h:outputText value="#{respostaHome.instance.cliques}"/>
        </s:decorate>

        <s:decorate id="correta" template="/layout/display.xhtml">
            <ui:define name="label">Correta</ui:define>
            <h:outputText value="#{respostaHome.instance.correta}"/>
        </s:decorate>


        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/resources/RespostaEdit.xhtml"
                    id="edit"
                 value="Editar"/>

        <s:button view="/resources/#{empty respostaFrom ? 'RespostaList' : respostaFrom}.xhtml"
                    id="done"
                 value="Concluído"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Questão</h:panelGroup>
        </f:facet>
    <div class="association" id="questaoParent">

        <h:outputText value="Não existe Questão atrelada a esta Resposta."
                   rendered="#{respostaHome.instance.questao == null}"/>

        <rich:dataTable var="_questao"
                   value="#{respostaHome.instance.questao}"
                rendered="#{respostaHome.instance.questao != null}"
              rowClasses="odd,even"
                      id="questaoTable">
            <h:column>
                <f:facet name="header">Enunciado</f:facet>
                <h:outputText value="#{_questao.questao}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Acertos</f:facet>
                <h:outputText value="#{_questao.acertos}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Erros</f:facet>
                <h:outputText value="#{_questao.erros}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Tipo da Questão</f:facet>
                <h:outputText value="#{_questao.tipoQuestao}"/>
            </h:column>
            <rich:column styleClass="action" style="text-align: center;">
                <f:facet name="header">Opções</f:facet>
                <s:link id="viewquestao"
                     value="Ver"
                      view="/resources/Questao.xhtml">
                    <f:param name="questaoId"
                           value="#{_questao.id}"/>
                </s:link>
            </rich:column>
        </rich:dataTable>

    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
